﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SkynetMaster.Master" Inherits="System.Web.Mvc.ViewPage<Skynet.BusinessEntities.Exam>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.min.js"></script>   

     <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Create</h2>
    <script type="text/javascript">
        $(document).ready(function () {

             var canClose = false; 

             $("#dialog").dialog({autoOpen:true , closeOnEscape: false, show: 'slide', hide: 'slide', resizable: false, modal: true});
             $("#dialog").dialog({ beforeClose: function(event, ui) { return canClose; } });
             $("#dialog").dialog("enable");
             $("#progressbar").progressbar({ value: 99 });
             $("#progressbar").progressbar("enable");            
             $.post("<%= Url.Action("CategoriesJson", "MgmCategories") %>", 
                function(data) {
                        $("#cbCategories").empty();
                        $.each(data, function(i, item) {
                                $("#cbCategories").append("<option id='" + item.Id +"'>" + item.Description + "</option>");
                                }                            
                        );
                        canClose  = true;
                        $("#progressbar").progressbar("destroy");
                        $("#dialog").dialog("close");
                });                   

        });           
    </script>    
    <div id="dialog" title="Wait please">
        <div id="progressbar"></div>
    </div>
    

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

        <fieldset>
            <legend>Fields</legend>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Id) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Id) %>
                <%: Html.ValidationMessageFor(model => model.Id) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Title) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Title) %>
                <%: Html.ValidationMessageFor(model => model.Title) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Summary) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Summary) %>
                <%: Html.ValidationMessageFor(model => model.Summary) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.CategoryExamId) %>
            </div>
            <div class="editor-field">
                 <select id="cbCategories"></select>                             
                <%: Html.ValidationMessageFor(model => model.CategoryExamId) %>
            </div>            
            <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>
    <% } %>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>


